<!--
 * @Author: lmk
 * @Date: 2021-11-22 10:46:22
 * @LastEditTime: 2021-12-01 16:21:28
 * @LastEditors: lmk
 * @Description: 
-->
<template>
	<view :class="currentTheme">
		<a-nabbar name="参展剧本" />
		<view class="content u-padding-top-32 u-padding-left-32 u-padding-right-32">
			<view class="u-flex u-margin-bottom-20">
				<view class="u-flex-1"><item-search placeholder="搜索发行或剧本" @change="downCallback" v-model="form.name"></item-search></view>
			</view>
			<mescroll-body @init="mescrollInit" @up="upCallback" @down="downCallback">
				<view v-for="(item, index) in dataList" :key="index" class="u-margin-bottom-20" @click="goPathDetail(item)">
					<list-item :item="item" :isShare="false">
						<view slot="content" style="width: 100%;">
							<!-- <view class="desc  u-font-24 u-margin-top-10 u-margin-bottom-14 u-line-3">{{item.info}}</view> -->
							<view class="desc u-font-24 content-desc-item u-line-3">展会酒店地址：{{ item.hotelAddress || '' }}{{ item.hotelRoomNo || '' }}</view>
							<view class="box-title u-font-24 u-margin-top-10 u-flex u-row-between">
								<view class="u-flex">
									展会价：
									<money :price="item.exhibitPrice" size="34" color="#765CFE"></money>
								</view>
								<view class="text-tips u-font-20">售价：￥{{ item.price }}</view>
							</view>
						</view>
					</list-item>
				</view>
			</mescroll-body>
		</view>
		<u-popup v-model="show" mode="right" width="70%">
			<a-nabbar :is-back="false" :border-bottom="false" />
			<view class="u-padding-32 text-white" v-if="show">
				<u-collapse :accordion="false" :head-style="itemStyle">
					<u-collapse-item :title="item.cateName" :open="item.open" v-for="(item, index) in selectList" :key="index">
						<view class="u-flex tag-box">
							<view class="tag-item" v-for="(val, i) in item.children" :key="i">
								<text class="tag-title" :class="item.checked.includes(val.id) ? 'checked-tag-title' : ''" @click="selectItem(item, val)">{{ val.cateName }}</text>
							</view>
						</view>
					</u-collapse-item>
				</u-collapse>
			</view>
			<view class="tag-btn-view"></view>
			<view class="tag-btns u-flex u-position-fixed">
				<view class="left-btn tag-btn" @click="resetBtn">重置</view>
				<view class="right-btn tag-btn" @click="category">确定</view>
			</view>
		</u-popup>

		<!-- 广告弹层 -->
		<view class="advertising">
			<u-mask :show="shows">
		 	<view class="warp">
					<view class="rect">
						<image :src="ad.imgUrl" mode="" @click="linkUrl"></image>
						<view class="advertising_label" @click="isShow"><image src="https://larp-gbo.oss-cn-chengdu.aliyuncs.com/larp/issue-index-light/icon--shanchu.png" mode=""></image></view>
					</view>
				</view>
			</u-mask>
		</view>
	</view>
</template>

<script>
import upCallback from '@/mixins/upCallbackMixin.js';
import searchMixins from '@/mixins/searchMixins.js';
import itemSearch from '@/components/itemSearch/itemSearch.vue';
import { getAdvertising } from '@/api/advertising.js';
export default {
	mixins: [upCallback, searchMixins],
	components: {
		itemSearch
	},
	data() {
		return {
			onlyShowOneTime: uni.getStorageSync('onlyShowOneTime'),
			advertising: '', // 广告图片
			shows: false,
			linkType: 2, // 广告类型
			content: {
				linkUrl: '', // 跳转链接
				linkType: '',
				id: ''
			},
			categoryIds: [],
			form: {
				name: ''
			},
			apiType: 'exhibitProduct',
			apiModule: 'shopApi',
			name: 'thirdQuery',
		  otherHeight:'88rpx',
			ad:{}
		};
	},
	  onLoad() {
	   if(this.onlyShowOneTime === 1) {
	      this.getAdvertising()
	      uni.setStorageSync('onlyShowOneTime',2)
	   }
	  },
	methods: {
		linkUrl(){
		      this.linkUrlHandle(this.ad)
		      this.shows = false
		    },
		    isShow() {
		      this.shows = false
		    },
		    async getAdvertising() {
		      try {
		        const res = await getAdvertising(this.linkType)
		        this.ad = res.content[0] || {};
		        this.shows = res.content.length>0
		        // console.log(res, '我是一只老鼠啊')
		        // this.advertising = res.content[0].imgUrl
		        // this.linkUrl = res.content[0].linkUrl
		        // this.content = res.content[0]
		      } catch (e) {
		        //TODO handle the exception
		      }
		    },
		goPathDetail(item) {
			this.$u.route({
				url: '/pagesA/itemDetail/itemDetail',
				params: {
					id: item.id,
					productId: item.productId,
					type: 'detailTestReply' //参展剧本评价
				}
			});
		}
	}
};
</script>
<style lang="scss" scoped>
@import '@/pages/pageStyle.scss';
.warp {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 550rpx;
  height: 746rpx;
  transform: translate(-50%, -50%);
  .rect {
    position: relative;
    width: 100%;
    height: 100%;
    image {
      width: 100%;
      height: 100%;
      border-radius: 24rpx;
    }
    .advertising_label {
      width: 100rpx;
      height: 100rpx;
      position: absolute;
      left: 48%;
      bottom: -150rpx;
      image {
        width: 52rpx;
        height: 52rpx;
      }
    }
  }
}
</style>
